package com.xnyzc.lhy.order.controller.log;


import com.xnyzc.lhy.common.entity.Rv;
import com.xnyzc.lhy.common.penum.EErrorCode;
import com.xnyzc.lhy.common.util.IDUtil;
import com.xnyzc.lhy.common.util.TokenUtil;
import com.xnyzc.lhy.order.entity.system.OaSysLog;
import com.xnyzc.lhy.order.service.order.OaDOrderOperationService;
import com.xnyzc.lhy.order.service.system.IOaSysLogService;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Date;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author cuixiaojian
 * @since 2019-12-17
 */
@RestController
@RequestMapping("/order/log")
public class OaSysLogController {

    @Autowired
    IOaSysLogService sysLogService;

    @PostMapping("/logRecord")
    public Rv logRecord(@ApiParam(name = "orderNo", value = "订单号") @RequestBody OaSysLog log) {
        log.setLogId(IDUtil.nextId());
        log.setCreateTime(new Date());
        log.setCreateUser(TokenUtil.getTokenUserId());
        log.setLogSource("CLIENT_SYS_LOG");
        sysLogService.save(log);
        return Rv.wrap(EErrorCode.success);
    }

}
